<template>
	<view class="container">
		<TopBtn :title="'问诊建议'"></TopBtn>
		<view class="info">
			<view class="textAreaBox">
				<view class="title">
					咨询诉求
				</view>
				<view class="text">
					{{data.appeal}}
				</view>
				<view class="title">
					问诊建议
				</view>
				<view class="text">
					{{data.proposal}}
				</view>
				<view class="title mar_Top flex-sp-center">
					整理时间： <view class="">
						<uni-dateformat :date="data.createTime" format="yyyy-MM-dd hh:mm"></uni-dateformat>
					</view>
				</view>
				<view class="title mar_Top flex-sp-center">
					整理人： <view class="">
						{{data.doctorName}} {{data.hospitalName}} | {{data.departName}}
					</view>
				</view>
			</view>
		</view>
		<view class="Btn" @click="createConsultationAdvice()">
			修改
		</view>
	</view>
</template>

<script>
	import {
		getConsultationAdvice,
		createConsultationAdvice
	} from '@/api/ConsultationRoom'
	export default {
		data() {
			return {
				value: "",
				data: {},
				updata: {
					appeal: "",
					proposal: "",
				}
			};
		},
		onLoad(options) {
			this.id = options.id
			this.getConsultationAdvice()
		},
		methods: {
			createConsultationAdvice() {
				this.updata.outpatientId = this.id
				this.updata.patientId = this.data.patientId
				if (!this.updata.appeal) {
					uni.showToast({
						title: '咨询诉求',
						duration: 2000,
						icon: 'none',
					})
					return
				}
				if (!this.updata.proposal) {
					uni.showToast({
						title: '问诊建议',
						duration: 2000,
						icon: 'none',
					})
					return
				}
				uni.showLoading({
					title: '提交中',
					mask: true
				})
				createConsultationAdvice(this.updata).then(res => {
					uni.showToast({
						title: '操作成功',
						duration: 200,
						icon: 'none',
						mask: true
					})
					setTimeout(() => {
						uni.hideLoading()
						uni.$emit('show', true)
						uni.navigateBack({
							delta: 1,
						})
					}, 200);
				})
			},
			getConsultationAdvice() {
				getConsultationAdvice({
					id: this.id
				}).then(res => {
					this.data = res.data
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.container {
		background-color: #fff;
	}

	.Btn {
		width: 649rpx;
		height: 100rpx;
		margin: 68rpx auto;
		background: #3B6CFE;
		border-radius: 50rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 100rpx;
	}

	.info {


		.textAreaBox {
			width: 750rpx;
			min-height: 633rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 0rpx 50rpx 50rpx;
			box-sizing: border-box;
			font-size: 32rpx;
			color: #333333;


			text {
				margin-right: 6rpx;
			}

			.title {
				font-weight: bold;
				margin: 30rpx 0;
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;

				view {
					color: #333333;
				}
			}

			.text {
				width: 649rpx;
				min-height: 175rpx;
				background: rgba(248, 250, 251, 0.49);
				border-radius: 10rpx;
				padding: 30rpx 20rpx;
				box-sizing: border-box;
				font-weight: 500;
				font-size: 28rpx;
				color: #333333;
			}

			.mar_Top {
				margin-top: 50rpx;
			}
		}
	}
</style>